import apiClient from "../apiClient";

export interface WechatLoginReq {
	code: string;
	state?: string;
}

export interface WechatLoginResult {
	token: string;
	userInfo: {
		id: string;
		nickname: string;
		avatar: string;
		[key: string]: any;
	};
}

/**
 * 微信登录
 */
export const wechatLogin = (data: WechatLoginReq) => {
	return apiClient.post<WechatLoginResult>({
		url: "/v1/wechat/mp/code2openid",
		data,
	});
};
